{extend name="admin@public/base_content" /}
{block name="body">}
<body>
{include file="admin@public/common" /}
<div class="container-fluid larry-wrapper">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane" action="{:url('')}">

                    <div class="layui-form-item">
                        <label class="layui-form-label">名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" value="{$info.name|default=''}" jq-verify="required" jq-error=" 请输入表名称" placeholder="请输入表名称" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">表名</label>
                        <div class="layui-input-block">
                            <input type="text" name="table" value="{$info.table|default=''}" required jq-verify="required|table" jq-error="请输入表名" placeholder="请输入表名" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">列表页</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="show_list" {eq name="info.show_list" value="1"}checked{/eq} title="开启" value="1" checked />
                            <input type="radio" name="show_list" {eq name="info.show_list" value="2"}checked{/eq} title="关闭" value="2" />
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">详细页</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="show_info" {eq name="info.show_info" value="1"}checked{/eq} title="开启" value="1" checked />
                            <input type="radio" name="show_info" {eq name="info.show_info" value="2"}checked{/eq} title="关闭" value="2" />
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">前台发布</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="post_status" {eq name="info.post_status" value="1"}checked{/eq} title="开启" value="1" checked />
                            <input type="radio" name="post_status" {eq name="info.post_status" value="2"}checked{/eq} title="关闭" value="2" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">前台分页数</label>
                        <div class="layui-input-inline">
                            <input type="text" name="list_page"  jq-verify="number" value="{$info.list_page|default='10'}" jq-error="必须为数字" placeholder="前台分页数" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">前台列表条件</label>
                        <div class="layui-input-block">
                            <input type="text" name="list_where" value="{$info.list_where|default=''}" jq-verify="" jq-error=" 标准SQL条件" placeholder="标准SQL条件" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">内容排序</label>
                        <div class="layui-input-block">
                            <input type="text" name="list_order" value="{$info.list_order|default='data_id desc'}" jq-verify="" jq-error=" 内容排序" placeholder="内容排序" class="layui-input ">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">列表模板</label>
                        <div class="layui-input-inline">
                            <input type="text" name="tpl_list" id="tpl_list" value="{$info.tpl_list|default='form_list'}"  class="layui-input ">
                        </div>
                        <div class="layui-input-inline">
                            <select jq-error="请选择" lay-filter="tpl_list">
                                <option value=""></option>
                                {foreach name='tplList' item='vo'}
                                <option value="{$vo.name}" {if condition="$vo.name eq $info.tpl_list"}selected{/if}>{$vo.file}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">详细模板</label>
                        <div class="layui-input-inline">
                            <input type="text" name="tpl_info" id="tpl_info" value="{$info.tpl_info|default='form_content'}"  class="layui-input ">
                        </div>
                        <div class="layui-input-inline">
                            <select jq-error="请选择" lay-filter="tpl_info">
                                <option value=""></option>
                                {foreach name='tplList' item='vo'}
                                <option value="{$vo.name}" {if condition="$vo.name eq $info.tpl_info"}selected{/if}>{$vo.file}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-input-block">
                        <input type="hidden" type="hidden" name="fieldset_id" value="{$info.fieldset_id}">
                        <button class="layui-btn" jq-submit lay-filter="submit" jq-tab="true">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </form>
            </section>
        </div>
    </div>
</div>
</body>
{/block}
{block name="script"}
<script>
    layui.use('myform', function(){
        var form = layui.form();
            jqform=layui.jqform;
        //自定义
        //各种基于事件的操作，下面会有进一步介绍
        form.on('select(tpl_list)', function(data){
            document.getElementById("tpl_list").value=data.value;
        });
        form.on('select(tpl_info)', function(data){
            document.getElementById("tpl_info").value=data.value;
        });
        jqform.verify({
            table:function (value) {
                if (value==''){
                    return '表名不能为空';
                }
                if (!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)) {
                    return '表名不能有特殊字符';
                }
                if (/(^\_)|(\__)|(\_+$)/.test(value)) {
                    return '表名首尾不能出现下划线\'_\'';
                }
                if(/.*[\u4e00-\u9fa5]+.*$/.test(value)){
                    return '表名不能含有汉字！';
                }

            }
        });
    });
</script>
{/block}